﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SitioINewThreadSoft.Ejemplos
{
    public partial class GridEnlaceCTbTinamica : System.Web.UI.Page
    {

        double sumaPagos = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                dlPagosCompra.ParametrosFiltroLista = new Dictionary<string, object>() { { "id_compra", 0 } };
            }
            dlPagosCompra.TablaDatos.ShowFooter = true;
            dlPagosCompra.CreacionFila += new Delta_webControl.DynamicData.Delta_grid.del_Grid_DataBound(dlPagosCompra_CreacionFila);
            dlPagosCompra.DeltaPadre = dlCompra;
            dlPagosCompra.AsignarTodosLosEstatusGlobales(true, Page);
        }

        void dlPagosCompra_CreacionFila(object sender, GridViewRowEventArgs ev)
        {

            if (ev.Row.RowType == DataControlRowType.DataRow)
            {
                sumaPagos += Delta_util.Clases.Comun.Convertir<Double>((ev.Row.DataItem as System.Data.DataRowView)[2]);
            }
            if (ev.Row.RowType == DataControlRowType.Footer)
            {

                ev.Row.Cells[3].Text = sumaPagos.ToString("$ #,##0.00");

            }
        }
    }
}